﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TVGS07
    { 
       
        public TVGS07()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            MV = new VGSCOLOR();
            DataContext = MV;
            InitializeComponent(); 
        }
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (EXAUF.Length < 23)
                return;
            dwData = TBMain.NewRow();
            dwData["GSCMANDANT"] = app.Mandant;
            dwData["GSCART"] = " AND GSCART = '" + EXAUF.Substring(1,20) + "'";
            SResult = TMV.QGC09(dwData);
            MergeData(SResult, false);
            base.OnEXAUFChg(vlaue);
            if (!IsAuto)
                return;
            if (TBMain.Rows.Count > 0)
                return;
            dwData = TBMain.NewRow();
            TMV.SetUpNewRow(ref dwData);
            dwData["GSCART"] = EXAUF.Substring(1, 20);
            dwData["GSCVAR"] = EXAUF.Substring(21, 3);
            dwData["GSCFARBE"] = "".PadRight(10);
            TBMain.Rows.InsertAt(dwData, 0);
            TMV.InsertGSCOLOR(dwData, app.company); 
            vwMaster.View.MoveCurrentToFirst();
        }
        
    }
}
